package com.cnap.multiclouldmgmt.util;

import com.cnap.multiclouldmgmt.MulticlouldmgmtApplicationTests;
import org.apache.http.entity.ContentType;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import static org.junit.jupiter.api.Assertions.*;

class FileUtilsTest extends MulticlouldmgmtApplicationTests {

    @Test
    void getFileContent() throws IOException {

        File file = new File("a.txt");
        if (!file.exists()){
            file.createNewFile();
        }
        FileInputStream fileInputStream = null;
        MultipartFile multipartFile = null;
        fileInputStream = new FileInputStream(file);
        multipartFile = new MockMultipartFile(file.getName(),file.getName(),
                ContentType.APPLICATION_OCTET_STREAM.toString(),fileInputStream);

        FileUtils.getFileContent(multipartFile);

    }
    
}